from django.db import models

class Area(models.Model):
    name = models.CharField(max_length=64, unique=True, verbose_name="区域")
    subnet = models.CharField(max_length=64, blank=True, null=True, verbose_name="IP地址段")
    
    class Meta:
        verbose_name_plural = "区域管理"

class Asset(models.Model):
    area = models.ForeignKey(Area, verbose_name='区域', on_delete=models.CASCADE)
    hostname = models.CharField(max_length=64, unique=True, verbose_name='主机名')
    ipadd = models.CharField(max_length=32, blank=True, null=True, verbose_name='IP地址')
    
    class Meta:
        verbose_name_plural = "资产信息"